import createApp from './create-app'


export default context => {
    return new Promise((resolve, reject)=>{
        const {app, router, store} = createApp()

        router.push(context.url)

        router.onReady(()=>{
            const matchedComponents = router.getMatchedComponents()
            if (!matchedComponents.length){
                reject(new Error('no component matched'))
            } else {
                context.meta = app.$meta()
                resolve(app)
            }
        })
    })
}